﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using DLV.Utilities;

namespace DLV.Data.Entities
{
    public class CommissionController
    {
        public int InsertCommission(CommissionInfo info)
        {
            return SQL.InsertCommission(info.Recipient, info.Quantity, info.Price, info.Total, info.CreatedBy, info.CreatedDate, info.UpdatedBy, info.UpdatedDate, info.Status, info.ScheduleId);
        }
        public void UpdateCommission(CommissionInfo info)
        {
            SQL.UpdateCommission(info.CommissionId, info.Recipient, info.Quantity, info.Price, info.Total, info.CreatedBy, info.CreatedDate, info.UpdatedBy, info.UpdatedDate, info.Status, info.ScheduleId);
        }
        public void DeleteCommission(CommissionInfo info)
        {
            DeleteCommission(info.CommissionId);
        }
        public void DeleteCommission(int commissionId)
        {
            SQL.DeleteCommission(commissionId);
        }
        public CommissionInfo GetCommission(int commissionId)
        {
            return CBO.FillObject<CommissionInfo>(SQL.GetCommission(commissionId));
        }
        public List<CommissionInfo> ListCommission()
        {
            return CBO.FillCollection<CommissionInfo>(SQL.ListCommission());
        }
        public DataTable SelectCommission()
        {
            return CBO.ConvertToDataTable(ListCommission(), typeof(CommissionInfo));
        }
        public List<CommissionInfo> ListCommissionBySchedule(int scheduleId)
        {
            return CBO.FillCollection<CommissionInfo>(SQL.ListCommissionBySchedule(scheduleId));
        }
        public List<CommissionInfo> ListCommissionByIds(string commissionIds)
        {
            return CBO.FillCollection<CommissionInfo>(SQL.ListCommissionByIds(commissionIds));
        }
    }
}
